package ooday04;
import  java.util.Scanner;
public class Test {
    public static void main(String[] args) {

  Master master=new Master();
        Dog dog=new Dog("小黑",1,"黑");
        Fish fish=new Fish("小黑",1,"黑");
        Chick chick=new Chick("小黑",1,"黑");
        master.feed(chick);
        master.feed(fish);
        master.feed(dog);

























//        Animal[] animal=new Animal[5];
//          animal[0]=new Fish("小金",1,"金");
//        animal[1]=new Dog("小黑",2,"黑");
//        animal[2]=new Dog("小黄",3,"黄");
//        animal[3]=new Chick("小灰",4,"灰");
//        animal[4]=new Chick("小白",5,"白");
//
//        animal[1].eat();
//        Dog dog=(Dog)animal[1];
//        dog.lookhome();
//        dog.Swim1();
//        for (int i = 0; i <animal.length ; i++) {
//            if (animal[i] instanceof  Dog){
//                Dog dog1=(Dog) animal[i];
//                dog1.lookhome();
//                dog1.Swim1();
//            }
//            if (animal[i] instanceof Chick){
//                Chick chick=(Chick) animal[i];
//                chick.downEgg();
//            }
//            if (animal[i] instanceof Fish){
//                Fish fish=(Fish) animal[i];
//                fish.Swim();
//            }
//        }























//        Animal[] animals = new Animal[5];
//        animals[0] = new Dog("小黑", 1, "黑");
//        animals[1] = new Dog("小黑", 1, "黑");
//        animals[2] = new Fish("小黑", 1, "黑");
//        animals[3] = new Fish("小白", 1, "白");
//        animals[4] = new Chick("小黄", 2, "黄");
//        animals[0].eat();
//        for (int i = 0; i < animals.length; i++) {
//            System.out.println(animals[i].name);
//            animals[i].drink();
//            animals[i].eat();
//            if (animals[i] instanceof Dog) {
//                Dog dog = (Dog) animals[i];
//                dog.lookhome();
//                dog.Swim1();
//            }
//            if (animals[i] instanceof Chick) {
//                Chick chicjk = (Chick) animals[i];
//              chicjk.downEgg();
//            }
//            if (animals[i] instanceof Fish) {
//                Fish fis = (Fish) animals[i];
//                fis.Swim();
//
//            }
//
//
//        }
//    }


//        Master master1 = new Master();
//        //  返回值类型  对象（实例）   被引用         模板
//                Dog   dog = new   Dog("小黑", 1, "黑");
//        Fish fis1h = new Fish("小黑", 1, "黑");
//        Chick chi1ck = new Chick("小白", 1, "白");
//        master1.feed(dog);
//        master1.feed(fis1h);
//
//    }
//匿名内部类,面向对象
    }
}